<% layout('/layouts/default.html', {title: '融资服务订单管理', libs: ['dataGrid']}){ %>
<div class="main-content">
	<div class="box box-main">
		<div class="box-header">
			<div class="box-title">
				<i class="fa icon-notebook"></i> ${text('融资服务订单管理')}
			</div>
			<div class="box-tools pull-right">
				<a href="#" class="btn btn-default" id="btnSearch" title="${text('查询')}"><i class="fa fa-filter"></i> ${text('查询')}</a>
				<% if(hasPermi('financing:finserviceorder:finServiceOrder:edit') ){ %>
					<a href="${ctx}/financing/finserviceorder/finServiceOrder/form" class="btn btn-default btnTool" title="${text('新增融资服务订单')}"><i class="fa fa-plus"></i> ${text('新增')}</a>
				<% } %>
				<a href="#" class="btn btn-default" id="btnSetting" title="${text('设置')}"><i class="fa fa-navicon"></i></a>
			</div>
		</div>
		<div class="box-body">
			<#form:form id="searchForm" model="${finServiceOrder}" action="${ctx}/financing/finserviceorder/finServiceOrder/listData" method="post" class="form-inline hide"
					data-page-no="${parameter.pageNo}" data-page-size="${parameter.pageSize}" data-order-by="${parameter.orderBy}">
                <div class="form-group">
                    <label class="control-label">${text('编号')}：</label>
                    <div class="control-inline width-120">
                        <#form:input path="financingServiceOrderCode" maxlength="100" class="form-control"/>
                    </div>
                </div>
                <div class="form-group">
                    <label class="control-label">${text('客户')}：</label>
                    <div class="control-inline width-120">
                        <#form:select path="customerId" items="${customerList}"
                        itemLabel="customerName" itemValue="customerId" dictType="" blankOption="true" class="form-control" onchange="getFramenumberByCuId()"/>
                    </div>
                </div>
				<div class="form-group">
					<label class="control-label">${text('车架号')}：</label>
					<div class="control-inline width-120">
						<#form:input path="frameNumber" maxlength="100" class="form-control"/>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">${text('代理公司')}：</label>
                    <div class="control-inline width-120" >
                        <#form:treeselect id="company" title="${text('公司选择')}"
                        path="company.companyCode" labelPath="company.companyName"
                        url="${ctx}/sys/company/treeData" canSelectRoot="true" canSelectParent="true"
                        class="" allowClear="true" />
                    </div>
				</div>
				<div class="form-group">
					<label class="control-label">${text('版型')}：</label>
					<div class="control-inline width-120">
						<#form:select path="area" dictType="car_quyu" blankOption="true" class="form-control"/>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">${text('车型')}：</label>
					<div class="control-inline width-120">
						<#form:input path="model" maxlength="100" class="form-control"/>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">${text('品牌')}：</label>
					<div class="control-inline width-120">
						<#form:select path="brand" dictType="car_pinpai" blankOption="true" class="form-control"/>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">${text('状态')}：</label>
					<div class="control-inline width-120">
						<#form:select path="recordStatus" dictType="bill_negotiated_status" blankOption="true" class="form-control isQuick"/>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">${text('国内资方')}：</label>
					<div class="control-inline width-120">
                        <#form:select path="investorId" class="form-control" items="${supplierList}"
                        itemLabel="supplierName" itemValue="supplierId" blankOption="true"/>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">${text('计息方式')}：</label>
					<div class="control-inline width-120">
						<#form:select path="calculationMethod" dictType="erp_calc_interest" blankOption="true" class="form-control"/>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">${text('融资地点')}：</label>
					<div class="control-inline width-120">
                        <#form:select path="financingLocation" class="form-control required" items="${twarehouseList}"
                        itemLabel="warehouseName" itemValue="warehouseId" blankOption="true" />
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">${text('融资方式')}：</label>
					<div class="control-inline width-120">
						<#form:select path="financingMethod" dictType="financing_method" blankOption="true" class="form-control"/>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">${text('创建者')}：</label>
                    <div class="control-inline width-120">
                        <#form:select path="createBy" items="${listUser}"
                        itemLabel="userName" itemValue="loginCode"  blankOption="true" class="form-control"/>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">${text('创建时间')}：</label>
					<div class="control-inline">
						<#form:input path="createDate_gte" readonly="true" maxlength="20" class="form-control laydate width-datetime"
							dataFormat="datetime" data-type="datetime" data-format="yyyy-MM-dd HH:mm" data-done="createDate_lte.click()"/>
						&nbsp;-&nbsp;
						<#form:input path="createDate_lte" readonly="true" maxlength="20" class="form-control laydate width-datetime"
							dataFormat="datetime" data-type="datetime" data-format="yyyy-MM-dd HH:mm"/>
					</div>
				</div>
				<div class="form-group">
					<button type="submit" class="btn btn-primary btn-sm">${text('查询')}</button>
					<button type="reset" class="btn btn-default btn-sm">${text('重置')}</button>
				</div>
			</#form:form>
			<table id="dataGrid"></table>
			<div id="dataGridPage"></div>
		</div>
	</div>
</div>
<% } %>
<script>
// 初始化DataGrid对象
$('#dataGrid').dataGrid({
	searchForm: $("#searchForm"),
	columnModel: [
		{header:'${text("编号")}', name:'financingServiceOrderCode', index:'a.financing_service_order_code', width:150, align:"center", frozen:true, formatter: function(val, obj, row, act){
			return '<a href="${ctx}/financing/finserviceorder/finServiceOrder/detail?financingServiceOrderId='+row.financingServiceOrderId+'" class="btnList" data-title="${text("编辑融资服务订单")}">'+(val||row.id)+'</a>';
		}},
        {header:'${text("操作")}', name:'actions', width:140, sortable:false, title:false,  frozen:true, formatter: function(val, obj, row, act){
                var actions = [];
            <% if(hasPermi('financing:finserviceorder:finServiceOrder:view')){ %>
                    actions.push('<a href="${ctx}/financing/finserviceorder/finServiceOrder/detail?financingServiceOrderId='+row.financingServiceOrderId+'" class="btnList" title="${text("查看融资服务订单")}"><i class="fa fa-file-text-o"></i></a>&nbsp;');
                <% } %>
            <% if(hasPermi('financing:finserviceorder:finServiceOrder:edit')){ %>
                    actions.push('<a href="${ctx}/financing/finserviceorder/finServiceOrder/form?financingServiceOrderId='+row.financingServiceOrderId+'" class="btnList" title="${text("编辑融资服务订单")}"><i class="fa fa-pencil"></i></a>&nbsp;');
                    actions.push('<a href="${ctx}/financing/finserviceorder/finServiceOrder/delete?financingServiceOrderId='+row.financingServiceOrderId+'" class="btnList" title="${text("删除融资服务订单")}" data-confirm="${text("确认要删除该融资服务订单吗？")}"><i class="fa fa-trash-o"></i></a>&nbsp;');
                <% } %>
                return actions.join('');
        }},
		{header:'${text("客户")}', name:'customer.customerName', index:'a.customer_id', width:150, align:"center"},
		{header:'${text("车架号")}', name:'frameNumber', index:'a.frame_number', width:150, align:"center"},
		{header:'${text("代理公司")}', name:'company.companyName', index:'a.company_id', width:150, align:"center"},
		{header:'${text("车款总金额")}', name:'carTotalAmount', index:'a.car_total_amount', width:150, align:"center", formatter: function(val, obj, row, act){
			return js.formatNumber(val, 2, false, ''); // 数值类型格式化 (原始数值, 小数位数, 是否千分位, 默认值，金额情况下设置0.00);
		}},
		{header:'${text("版型")}', name:'area', index:'a.area', width:150, align:"center", formatter: function(val, obj, row, act){
			return js.getDictLabel(${@DictUtils.getDictListJson('car_quyu')}, val, '${text("")}', true);
		}},
		{header:'${text("车型")}', name:'model', index:'a.model', width:150, align:"center"},
		{header:'${text("品牌")}', name:'brand', index:'a.brand', width:150, align:"center", formatter: function(val, obj, row, act){
			return js.getDictLabel(${@DictUtils.getDictListJson('car_pinpai')}, val, '${text("")}', true);
		}},
		{header:'${text("状态")}', name:'recordStatus', index:'a.status1', sortable:false,width:150, align:"center", formatter: function(val, obj, row, act){
			return js.getDictLabel(${@DictUtils.getDictListJson('bill_negotiated_status')}, val, '${text("")}', true);
		}},
		{header:'${text("国内资方")}', name:'supplier.supplierName', index:'a.investor_id', width:150, align:"center"},
		{header:'${text("计息方式")}', name:'calculationMethod', index:'a.calculation_method', width:150, align:"center", formatter: function(val, obj, row, act){
			return js.getDictLabel(${@DictUtils.getDictListJson('erp_calc_interest')}, val, '${text("")}', true);
		}},
		{header:'${text("融资地点")}', name:'warehouse.warehouseName', index:'a.financing_location', width:150, align:"center"},
		{header:'${text("融资方式")}', name:'financingMethod', index:'a.financing_method', width:150, align:"center", formatter: function(val, obj, row, act){
			return js.getDictLabel(${@DictUtils.getDictListJson('financing_method')}, val, '${text("")}', true);
		}},
		{header:'${text("最少天数")}', name:'minimumDay', index:'a.minimum_day', width:150, align:"center"},
		// {header:'${text("还款日期")}', name:'investorRepaymentDate', index:'a.investor_repayment_date', width:150, align:"center"},
		// {header:'${text("发生天数")}', name:'investorDays', index:'a.investor_days', width:150, align:"center"},
		// {header:'${text("利息合计")}', name:'investorTotalInterest', index:'a.investor_total_interest', width:150, align:"right", formatter: function(val, obj, row, act){
		// 	return js.formatNumber(val, 2, false, ''); // 数值类型格式化 (原始数值, 小数位数, 是否千分位, 默认值，金额情况下设置0.00);
		// }},
		// {header:'${text("本息合计")}', name:'investorTotalPrincipalInterest', index:'a.investor_total_principal_interest', width:150, align:"right", formatter: function(val, obj, row, act){
		// 	return js.formatNumber(val, 2, false, ''); // 数值类型格式化 (原始数值, 小数位数, 是否千分位, 默认值，金额情况下设置0.00);
		// }},
		// {header:'${text("还款日期")}', name:'customerRepaymentDate', index:'a.customer_repayment_date', width:150, align:"center"},
		// {header:'${text("发生天数")}', name:'customerDays', index:'a.customer_days', width:150, align:"center"},
		// {header:'${text("客户利息合计")}', name:'customerTotalInterest', index:'a.customer_total_interest', width:150, align:"right", formatter: function(val, obj, row, act){
		// 	return js.formatNumber(val, 2, false, ''); // 数值类型格式化 (原始数值, 小数位数, 是否千分位, 默认值，金额情况下设置0.00);
		// }},
		// {header:'${text("客户本息合计")}', name:'customerTotalPrincipalInterest', index:'a.customer_total_principal_interest', width:150, align:"right", formatter: function(val, obj, row, act){
		// 	return js.formatNumber(val, 2, false, ''); // 数值类型格式化 (原始数值, 小数位数, 是否千分位, 默认值，金额情况下设置0.00);
		// }},
        {header:'${text("创建者")}', name:'createBy', index:'a.create_by', width:150, align:"center"},
        {header:'${text("创建时间")}', name:'createDate', index:'a.create_date', width:150, align:"center"},
        {header:'${text("更新者")}', name:'updateBy', index:'a.update_by', width:150, align:"center"},
        {header:'${text("更新时间")}', name:'updateDate', index:'a.update_date', width:150, align:"center"},
		{header:'${text("备注信息")}', name:'remarks', index:'a.remarks', width:150, align:"center"}
	],
    frozenCols:true,
	// 加载成功后执行事件
	ajaxSuccess: function(data){
		
	}
});
</script>